package hihocoder;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 剑刃风暴 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int R=scanner.nextInt();
		int[] X=new int[N];
		int[] Y=new int[N];
		for (int i = 0; i < N; i++) {
			X[i]=scanner.nextInt();
			Y[i]=scanner.nextInt();
		}
		int maxRes=0;
		for (int i = 0; i < Y.length; i++) {
			for (int j = i+1; j < Y.length; j++) {
				double detaX=X[i]-X[j];
				double detaY=Y[i]-Y[j];
				double dist=Math.sqrt((detaX)*(detaX)+(detaY)*(detaY));
				if(dist>(double)R*2)//这两点的距离要<=2R,才能以中点为圆心
					continue;
				int tmpRes=2;//至少覆盖这两个点
				double midX=((double)X[i]+X[j])/2;//以这两个点在圆上，R为半径找到合适的圆心
				double midY=((double)Y[i]+Y[j])/2;
				//求圆心
				double a=Math.atan2(detaX,detaY);
				double d=Math.sqrt(R*R-dist*dist/4);//圆心到ij连线的距离
				midX+=d*Math.cos(a);//真正的圆心
				midY+=d*Math.sin(a);
				for (int k = 0; k < Y.length; k++) {
					if(k==i||k==j){
						continue;
					}
					//看看是否能覆盖其他的点

					detaX=X[k]-midX;
					detaY=Y[k]-midY;
					if((detaX)*(detaX)+(detaY)*(detaY)<=(double)R*R){
						tmpRes++;
//						System.out.println(X[i]+","+Y[i]+"    "+X[j]+","+Y[j]+"    "+midX+","+midY+"包含了"+X[k]+","+Y[k]);
//						System.out.println(tmpRes);
					}
				}
				if(tmpRes>maxRes)
					maxRes=tmpRes;
			}
		}
		System.out.println(maxRes);
	}

}
